package advance_2;

import java.util.Arrays;
import java.util.Random;

public class RandomTest {
    public static void main(String[] args) {
        Random r=new Random();
        System.out.println("随机整数:");
        for(int i=1;i<=30;i++){
            System.out.print (r.nextInt());
            System.out.print(' ');
        }
        System.out.println();
        System.out.println("随机长整数:");
        for(int i=1;i<=30;i++){
            System.out.print (r.nextLong());
            System.out.print(' ');
        }
        System.out.println();
        System.out.println("随机浮点数:");
        for(int i=1;i<=30;i++){
            System.out.print (r.nextGaussian());
            System.out.print(' ');
        }
        System.out.println();
        System.out.println("随机bool:");
        for(int i=1;i<=30;i++){
            System.out.print (r.nextBoolean());
            System.out.print(' ');
        }
        System.out.println();
        System.out.println("限制整数范围:");
        for(int i=1;i<=30;i++){
            System.out.print (r.nextInt(200));
            System.out.print(' ');
        }
        System.out.println();
        byte b[]=new byte[50];
        r.nextBytes(b);
        System.out.println(Arrays.toString(b));
    }
}
